<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Chapter 28. Boost.Program_options</title>
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="libraries.html" title="Part I. The Boost C++ Libraries (BoostBook Subset)">
<link rel="prev" href="poly_collection/acknowledgements.html" title="Acknowledgements">
<link rel="next" href="program_options/tutorial.html" title="Tutorial">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../boost.png"></td>
<td align="center"><a href="../../index.html">Home</a></td>
<td align="center"><a href="../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="poly_collection/acknowledgements.html"><img src="../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.html"><img src="../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="program_options/tutorial.html"><img src="../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="chapter">
<div class="titlepage"><div>
<div><h2 class="title">
<a name="program_options"></a>Chapter 28. Boost.Program_options</h2></div>
<div><div class="author"><h3 class="author">
<span class="firstname">Vladimir</span> <span class="surname">Prus</span>
</h3></div></div>
<div><p class="copyright">Copyright © 2002-2004 Vladimir Prus</p></div>
<div><div class="legalnotice">
<a name="id-1.3.29.1.3"></a><p>Distributed under the Boost Software License, Version 1.0.
      (See accompanying file <code class="filename">LICENSE_1_0.txt</code> or copy at 
      <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></div>
</div></div>
<div class="toc">
<p><b>Table of Contents</b></p>
<dl class="toc">
<dt><span class="section"><a href="program_options.html#id-1.3.29.3">Introduction</a></span></dt>
<dt><span class="section"><a href="program_options/tutorial.html">Tutorial</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="program_options/tutorial.html#id-1.3.29.4.3">Getting Started</a></span></dt>
<dt><span class="section"><a href="program_options/tutorial.html#id-1.3.29.4.4">Option Details</a></span></dt>
<dt><span class="section"><a href="program_options/tutorial.html#id-1.3.29.4.5">Multiple Sources</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="program_options/overview.html">Library Overview</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="program_options/overview.html#id-1.3.29.5.7">Options Description Component</a></span></dt>
<dt><span class="section"><a href="program_options/overview.html#id-1.3.29.5.8">Parsers Component</a></span></dt>
<dt><span class="section"><a href="program_options/overview.html#id-1.3.29.5.9">Storage Component</a></span></dt>
<dt><span class="section"><a href="program_options/overview.html#id-1.3.29.5.10">Specific parsers</a></span></dt>
<dt><span class="section"><a href="program_options/overview.html#id-1.3.29.5.11">Types</a></span></dt>
<dt><span class="section"><a href="program_options/overview.html#id-1.3.29.5.12">Annotated List of Symbols</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="program_options/howto.html">How To</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="program_options/howto.html#id-1.3.29.6.3">Non-conventional Syntax</a></span></dt>
<dt><span class="section"><a href="program_options/howto.html#id-1.3.29.6.4">Response Files</a></span></dt>
<dt><span class="section"><a href="program_options/howto.html#id-1.3.29.6.5">Winmain Command Line</a></span></dt>
<dt><span class="section"><a href="program_options/howto.html#id-1.3.29.6.6">Option Groups and Hidden Options</a></span></dt>
<dt><span class="section"><a href="program_options/howto.html#id-1.3.29.6.7">Custom Validators</a></span></dt>
<dt><span class="section"><a href="program_options/howto.html#id-1.3.29.6.8">Unicode Support</a></span></dt>
<dt><span class="section"><a href="program_options/howto.html#id-1.3.29.6.9">Allowing Unknown Options</a></span></dt>
<dt><span class="section"><a href="program_options/howto.html#id-1.3.29.6.10">Testing Option Presence</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="program_options/design.html">Design Discussion</a></span></dt>
<dd><dl><dt><span class="section"><a href="program_options/design.html#program_options.design.unicode">Unicode Support</a></span></dt></dl></dd>
<dt><span class="section"><a href="program_options/s06.html">Acknowledgements</a></span></dt>
<dt><span class="section"><a href="program_options/reference.html">Reference</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="program_options/reference.html#doxygen.cmdline_8hpp">Header &lt;boost/program_options/cmdline.hpp&gt;</a></span></dt>
<dt><span class="section"><a href="program_options/reference.html#doxygen.config_8hpp">Header &lt;boost/program_options/config.hpp&gt;</a></span></dt>
<dt><span class="section"><a href="program_options/reference.html#doxygen.environment__iterator_8hpp">Header &lt;boost/program_options/environment_iterator.hpp&gt;</a></span></dt>
<dt><span class="section"><a href="program_options/reference.html#doxygen.eof__iterator_8hpp">Header &lt;boost/program_options/eof_iterator.hpp&gt;</a></span></dt>
<dt><span class="section"><a href="program_options/reference.html#doxygen.errors_8hpp">Header &lt;boost/program_options/errors.hpp&gt;</a></span></dt>
<dt><span class="section"><a href="program_options/reference.html#doxygen.option_8hpp">Header &lt;boost/program_options/option.hpp&gt;</a></span></dt>
<dt><span class="section"><a href="program_options/reference.html#doxygen.options__description_8hpp">Header &lt;boost/program_options/options_description.hpp&gt;</a></span></dt>
<dt><span class="section"><a href="program_options/reference.html#doxygen.parsers_8hpp">Header &lt;boost/program_options/parsers.hpp&gt;</a></span></dt>
<dt><span class="section"><a href="program_options/reference.html#doxygen.positional__options_8hpp">Header &lt;boost/program_options/positional_options.hpp&gt;</a></span></dt>
<dt><span class="section"><a href="program_options/reference.html#doxygen.value__semantic_8hpp">Header &lt;boost/program_options/value_semantic.hpp&gt;</a></span></dt>
<dt><span class="section"><a href="program_options/reference.html#doxygen.variables__map_8hpp">Header &lt;boost/program_options/variables_map.hpp&gt;</a></span></dt>
<dt><span class="section"><a href="program_options/reference.html#doxygen.version_8hpp">Header &lt;boost/program_options/version.hpp&gt;</a></span></dt>
</dl></dd>
</dl>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="id-1.3.29.3"></a>Introduction</h2></div></div></div>
<p>The program_options library allows program developers to obtain
    <span class="emphasis"><em>program options</em></span>, that is (name, value) pairs from the user,
    via conventional methods such as command line and config file.</p>
<p>Why would you use such a library, and why is it better than parsing
    your command line by straightforward hand-written code?
      </p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>It's easier. The syntax for declaring options is simple, and
          the library itself is small. Things like conversion of option values to
          desired type and storing into program variables are handled
          automatically.
          </p></li>
<li class="listitem"><p>Error reporting is better. All the problems with the command line are
            reported, while hand-written code can just misparse the input. In
            addition, the usage message can be automatically generated, to
            avoid falling out of sync with the real list of options.</p></li>
<li class="listitem"><p>Options can be read from anywhere. Sooner or later the command
          line will be not enough for your users, and you'll want config files
          or maybe even environment variables. These can be added without significant 
          effort on your part.
          </p></li>
</ul></div>
<p>
    </p>
<p>
      Now let's see some examples of the library usage in the <a class="xref" href="program_options/tutorial.html" title="Tutorial">the section called “Tutorial”</a>.
    </p>
</div>
</div>
<div class="copyright-footer"></div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="poly_collection/acknowledgements.html"><img src="../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.html"><img src="../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="program_options/tutorial.html"><img src="../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
